#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: title03统计差异值大于相似值二元组个数.py 
@version:
@time: 2023/05/31 
"""


def solve_method(n, nums):
    count = 0
    for i in range(n-1):
        for j in range(i+1, n):
            if nums[i]^nums[j]>nums[i]&nums[j]:
                count+=1
    return count

if __name__ == "__main__":
    n = int(input().strip())
    nums = list(map(int, input().strip().split()))
    res = solve_method(n, nums)
    print(res)
